package com.example.demo.Listener;

import com.example.demo.bean.UserBean;
import com.example.demo.event.UserRegisterEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @author ml
 * @create 2017-08-02--17:20
 */
@Component
public class ApplicationRegisterListener implements ApplicationListener<UserRegisterEvent>{

    /**
     * 实现监听
     * @param userRegisterEvent
     */
    @Override
    public void onApplicationEvent(UserRegisterEvent userRegisterEvent) {
        UserBean userBean=userRegisterEvent.getUserBean();
        System.out.println("实现aoolicationevent注册信息，用户名："+userBean.getName()+",密码："+userBean.getPassword());
    }
}
